<template>
  <a-spin :spinning="spinning">
    <base-breadcrumb>

      <template v-slot:content>
        <a-card :body-style="{ padding: '24px 32px' }" :bordered="false">
          <title-name title="双优化立项信息"/>
          <baseInfo :form="dels"></baseInfo>
        </a-card>

        <a-card :body-style="{ padding: '24px 32px' }" style="margin-top: 20px" :bordered="false"
                v-if="(((isEdit == 0 || isAudit)&&form.isImpl!==null) || isEdit == 1)&&(statusCode!=2 && statusCode!=3 && statusCode!=4)"
        >
          <title-name title="双优化销项信息"/>
          <a-form-model ref="form1" layout="horizontal" :model="form" :rules="rules">
            <a-row :gutter="24">
              <a-col :md="8" :sm="8">
                <a-form-model-item label="实施情况" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                                   :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }" prop="isImpl">
                  <a-select v-model="form.isImpl" placeholder="请选择" :disabled="isAudit">
                    <a-select-option :value="1"> 已实施</a-select-option>
                    <a-select-option :value="0"> 未实施</a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :md="8" :sm="8" v-if="form.isImpl === 1">
                <a-form-model-item label="实施效益(万)" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                                   :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                                   class="requiredFormItem"
                                   prop="implementBenefits">
                  <a-input-number style="width: 100%" :max="9999999999" :min="0" :precision="2"
                                  placeholder="请输入" autocomplete="off"
                                  v-model="form.implementBenefits"
                                  :disabled="isAudit"
                  ></a-input-number>
                </a-form-model-item>
              </a-col>
              <a-col :md="8" :sm="8" v-if="form.isImpl === 1">
                <a-form-model-item label="实际实施时间" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                                   :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                                   class="requiredFormItem"
                                   prop="implementDate">
                  <!--                <BaseInput v-model="form.seller" />-->
                  <a-range-picker v-model:value="form.implementDate" format="YYYY-MM-DD"
                                  value-format="YYYY-MM-DD"
                                  :disabled="isAudit"
                  />
                </a-form-model-item>
              </a-col>
              <a-col :md="24" :sm="24" v-if="form.isImpl === 1">
                <a-form-model-item label="备注信息" :label-col="{ lg: { span: 2 }, sm: { span: 2 } }"
                                   class="requiredFormItem"
                                   :wrapper-col="{ lg: { span: 22 }, sm: { span: 22 } }" prop="remark">
                  <BaseTextarea v-model="form.remark" placeholder="备注信息"
                                :disabled="isAudit"
                  />
                </a-form-model-item>
              </a-col>
              <a-col :md="8" :sm="8" v-if="form.isImpl === 1">
                <a-form-model-item label="商务处理人" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                                   :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                                   class="requiredFormItem"
                                   prop="businessUserId">
                  <!--                <BaseInput v-model="form.seller" placeholder="" disabled />-->
                  <SelectPersonByProject
                          :projectId="dels.projectId"
                          show-search
                          v-model="form.businessUserId"
                          :disabled="isAudit"
                  ></SelectPersonByProject>
                </a-form-model-item>
              </a-col>
              <a-col :md="8" :sm="8">
                <a-form-model-item label="销项人" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                                   :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }" prop="seller">
                  <BaseInput v-model="form.sellerName" placeholder="" disabled/>
                </a-form-model-item>
              </a-col>
              <a-col :md="8" :sm="8">
                <a-form-model-item label="销项时间" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                                   :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
                  <BaseInput v-model="form.salesTime" placeholder="" disabled/>
                </a-form-model-item>
              </a-col>
              <a-col :span="24" v-if="form.economicBenefitsScope&&$route.query.view">
                <a-form-model-item label="经济效益计算范围" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                                   :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
                  <BaseTextarea v-model="form.economicBenefitsScope" placeholder="" disabled/>
                </a-form-model-item>
              </a-col>

              <a-col :span="24" v-if="form.economicBenefitsMethod&&$route.query.view">
                <a-form-model-item label="经济效益计算方法及说明" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                                   :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
                  <BaseTextarea v-model="form.economicBenefitsMethod" placeholder="" disabled/>
                </a-form-model-item>
              </a-col>
              <a-col :span="24" v-if="form.level&&$route.query.view">
                <a-form-model-item label="等级" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                                   :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
                  <BaseInput v-model="form.level" placeholder="" disabled/>
                </a-form-model-item>
              </a-col>
              <a-col :md="24" :sm="24" v-if="form.isImpl === 1">
                <a-form-model-item label="现场实施照片（请至少上传五张照片）"
                                   :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                                   :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
                  <l-table
                          uploadType="image"
                          :editModel="2"
                          :business-code="businessCode"
                          :upload-arrys.sync="form.outputPictureIdsInfo"
                          :disabled="isAudit"
                  />
                </a-form-model-item>
              </a-col>
            </a-row>

            <a-row :gutter="24" v-if="form.isImpl === 0">
              <a-col :md="24" :sm="24">
                <a-form-model-item label="未实施原因及说明" :label-col="{ lg: { span: 2 }, sm: { span: 2 } }"
                                   :wrapper-col="{ lg: { span: 22 }, sm: { span: 22 } }" prop="remark"
                                   class="requiredFormItem">
                  <BaseTextarea v-model="form.remark" placeholder="未实施原因及说明"
                                :disabled="isAudit"
                  />
                </a-form-model-item>
              </a-col>
            </a-row>
            <title-name title="相关附件"/>
            <BTableUpload v-model="fileIds" :business-code="businessCode" btnName="上传附件"
                          :disabled="isAudit">
              <span slot="tips" style="margin-left: 5px">请上传图纸证明材料等</span>
            </BTableUpload>
          </a-form-model>
        </a-card>
        <a-card :bordered="false" v-if="!(statusCode ==2&&isEdit==0)">
          <title-name v-if="statusCode ==2 || dels.statusCode == 3 || dels.statusCode == 4" title="双优化验收信息"/>
          <a-form-model v-if="statusCode ==2 || dels.statusCode == 3 || dels.statusCode == 4" ref="form2" layout="horizontal"
                        :model="form2" :rules="rules">
            <a-row :gutter="24">
              <a-col :md="8" :sm="8">
                <a-form-model-item label="实际完成时间" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                                   :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                                   prop="completeTime">
                  <a-date-picker v-model="form2.completeTime" style="width: 100%" :disabled="statusCode !=2 "/>
                </a-form-model-item>
              </a-col>
              <a-col :md="8" :sm="8">
                <a-form-model-item label="主要实施人员" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                                   :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                                   prop="implementers">
                                  <a-select v-model="form2.implementers" mode="multiple" placeholder="请选择" v-if="statusCode==2">
                                    <a-select-option v-for="item in implementers" :key="item.id" :value="item.id">
                                      {{ item.name }}
                                    </a-select-option>
                                  </a-select>
                  <BaseInput v-model="form.mainImplsName" disabled v-else></BaseInput>
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row :gutter="24">
              <a-col :md="8" :sm="8">
                <a-form-model-item label="实际减亏效益（万）" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                                   :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                                   prop="actualReduceBenefit">
                  <BaseInputNumber v-model="form2.actualReduceBenefit" :min="0" :disabled="statusCode !=2 "
                                   placeholder="请输入"
                                   :max="10000000000"
                                   @change="getReduceBenefit(form2.actualReduceBenefit)"/>
                </a-form-model-item>
              </a-col>
              <a-col :md="8" :sm="8">
                <a-form-model-item label="实际增加效益（万）" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                                   :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }"
                                   prop="actualIncreaseBenefit">
                  <BaseInputNumber v-model="form2.actualIncreaseBenefit" :min="0" :disabled="statusCode !=2 "
                                   placeholder="请输入" :max="10000000000"
                                   @change="getTotalBenefit(form2.actualIncreaseBenefit)"/>
                </a-form-model-item>
              </a-col>
              <a-col :md="8" :sm="8">
                <a-form-model-item label="实际效益（万）" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                                   :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
                  <BaseInput v-model="form2.actualBenefit" disabled />
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row :gutter="24">
              <a-col :md="24" :sm="24">
                <a-form-model-item label="验收概述" :label-col="{ lg: { span: 2 }, sm: { span: 2 } }"
                                   :wrapper-col="{ lg: { span: 22 }, sm: { span: 22 } }">
                  <!--<BaseInput v-model="form.resultInfo" disabled/>-->
                  <!--<quill-editor></quill-editor>-->
                  <editor :value="form2.acceptance" @change="editorContent" :disabled="statusCode !=2" />
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row>
              <a-col :span="24">
                <title-name title="相关附件"/>
                <BTableUpload v-model="checkFiles" :business-code="businessCode" btnName="上传附件"
                              :disabled="isAudit">
                  <span slot="tips" style="margin-left: 5px">请上传图纸证明材料等</span>
                </BTableUpload>
              </a-col>
            </a-row>
          </a-form-model>
        </a-card>
        <a-card v-if="dels.confirmationContentOne&&$route.query.view">
          <title-name title="项目内部确认"></title-name>
          <a-table :columns="column" :dataSource="dataSource3" :pagination="false" bordered>
          </a-table>
        </a-card>
        <a-card v-if="form.useSite&&$route.query.view">
          <title-name title="补充双优化案例信息"/>
          <a-form-model layout="horizontal" :label-col="{ lg: { span: 7 }, sm: { span: 7 } }"
                        :wrapper-col="{ lg: { span: 17 }, sm: { span: 17 } }">
            <a-row>
              <a-col :span="24">
                <a-form-model-item label="使用部位">
                  <BaseInput v-model="form.useSite" placeholder="" disabled/>
                </a-form-model-item>
              </a-col>
              <a-col :span="24">
                <a-form-model-item label="优化理由">
                  <BaseTextarea v-model="form.optimizationRationale" placeholder="" disabled/>
                </a-form-model-item>
              </a-col>
              <a-col :span="24">
                <a-form-model-item label="优化背景">
                  <BaseTextarea v-model="form.optimizationBackground" placeholder="" disabled/>
                </a-form-model-item>
              </a-col>
              <a-col :span="24">
                <a-form-model-item label="适用范围">
                  <BaseTextarea v-model="form.applicationScope" placeholder="" disabled/>
                </a-form-model-item>
              </a-col>
              <a-col :span="24">
                <a-form-model-item label="使用提示">
                  <BaseTextarea v-model="form.useSite" placeholder="" disabled/>
                </a-form-model-item>
              </a-col>
            </a-row>


            <a-form-model-item label="现场实施照片（请至少上传五张照片）">
              <l-table
                      uploadType="image"
                      :editModel="2"
                      :business-code="businessCode"
                      :upload-arrys.sync="form.promotionFileIdsInfo"
                      :disabled="isAudit"
              />
            </a-form-model-item>
          </a-form-model>
        </a-card>

        <div style="float: right" class="page-btn-right-top" v-if="!isAudit">
          <a-button type="primary" @click="submit" :loading="loading"> 提交</a-button>
          <a-button class="ml12" type="primary" @click="goBack"> 关闭</a-button>
        </div>
        <div style="float: right" class="page-btn-right-top" v-if="isEdit == 0">
          <a-button @click="goBack"> 关闭</a-button>
        </div>
      </template>
      <selectApprover :businessId="businessId" :processConfig="setProcessConfig"></selectApprover>
    </base-breadcrumb>
  </a-spin>
</template>

<script>
  import {
    editImplementation
  } from '@/api/project/implementation'
  import { getUserBranch, getUserProject, getProjectsDel } from '@/api/project/projects'
  import { getOptimizationDetails } from '@/api/project/optimization'
  import { updateImplementation, editImplementAcceptance} from '@/api/project/implementation'
  import { uploadFile, deleteUploadFile } from '@/api'
  import editor from '@/components/Editor/editor'
  import baseInfo from './components/baseInfo'
  import SelectPersonByProject from '@/components/Select/SelectPersonByProject' // 人员选择

  import { column, dataSource3 } from './model'

  const columns = [
    {
      title: '序号',
      width: 65,
      dataIndex: 'serial',

      scopedSlots: { customRender: 'serial' }
    },
    {
      title: '设计资源名称',
      dataIndex: 'name',
      width: '20%'
    },
    {
      title: '设计资源类型',
      dataIndex: 'type',
      width: '30%'
    },
    {
      title: '设计资源等级',
      dataIndex: 'level',
      width: '30%'
    }
  ]

  const columnAssment = [
    {
      title: '序号',
      width: 65,
      dataIndex: 'serial',

      scopedSlots: { customRender: 'serial' }
    },
    {
      title: '附件名称',
      dataIndex: 'fileName',
      width: '35%'
    },
    {
      title: '附件格式',
      dataIndex: 'suffixName',
      width: '35%'
    },
    {
      title: '操作',
      key: 'action',
      width: '20%',
      scopedSlots: { customRender: 'action' }
    }
  ]
  export default {
    name: 'a' + Date.now(),
    components: {
      editor,
      baseInfo,
      SelectPersonByProject
    },
    data() {
      return {
        spinning: false,
        column,
        columns,
        columnAssment,
        dataSource3,
        // 附件上传
        dataAssement: [],
        uploadFile: {},
        deleteObj: {},
        token: '',
        fileFileds: null,
        fileIds: [],
        checkFiles: [],
        loading: false,
        businessCode: 'PM18',

        selectedRowKeys: [],
        selectedRows: [],
        selectId: [],

        implementers: [],
        data: [],
        dels: {
          viewName: '',
          projectId: ''
        },
        dataSource: [
          { name: '', type: '设计单位', level: '' },
          { name: '', type: '设计专家', level: '' },
          { name: '', type: '海外设计单位', level: '' },
          { name: '', type: '海外设计专家', level: '' }
        ],

        visible: false,
        title: '选择设计资源',

        form: {
          promotionFileIdsInfo: [],
          outputPictureIdsInfo: [],
          isImpl: 1,
          remark: '',
          fileInfos: [],
          implementDate: [],
          implementBenefits: '',
          businessUserId: ''

        },
        form2: {
          actualBenefit: '',
          actualReduceBenefit: '',
          actualIncreaseBenefit: ''
        },
        currentDate: '', // 当前日期

        isEdit: '',
        id: '',

        companys: [],
        projectNames: [],
        projectType: '',
        statusCode: '',
        reviewButton: null,

        rules: {
          isImpl: [{ required: true, message: '请选择实际情况', trigger: 'change' }],
          completeTime: [{ required: true, message: '请选择实际完成时间', trigger: 'change' }],
          implementers: [{ required: true, message: '请选择主要实施人员', trigger: 'change' }],
          actualReduceBenefit: [{ required: true, message: '请输入实际减亏效益', trigger: 'blur' }],
          remark: [{ required: true, message: '请输入备注信息', trigger: 'blur' }],
          actualIncreaseBenefit: [{ required: true, message: '请输入实际增加效益', trigger: 'blur' }],
          actualBenefit: [{ required: true, message: '请输入实际效益', trigger: 'blur' }],
          acceptance: [{ required: true, message: '请输入验收概述', trigger: 'blur' }],
          implementDate: [{ type: 'array', required: true, message: '请选择实际实施时间', trigger: 'change' }],
          implementBenefits: [{ required: true, message: '请输入实施效益', trigger: 'blur' }],
          businessUserId: [{ required: true, message: '请选择商务处理人', trigger: 'change' }]
        },
        //获取流程配置值
        processConfig: null,
        //点击提交发送流程配置值
        setProcessConfig: null,
        businessId: null,
        isAudit: false
      }
    },

    async created() {
      this.form = {
        ...this.form
      }
      this.id = this.$route.query.id
      if (this.$route.query.businessId) {
        this.isAudit = true
        this.id = this.$route.query.businessId.replace('_C_A_N', '').replace('_P_R_O', '').replace('_A_C_C', '')
      }
      this.isEdit = this.$route.query.isEdit
      if (this.isEdit == 0) {
        this.isAudit = true
      }
      this.statusCode = this.$route.query.statusCode
      this.reviewButton = this.$route.query.reviewButton

      if (this.isEdit == 1 || this.isEdit == 0 || this.$route.query.businessId) {
        this.getOptimizationDetails()
      }
      if(this.statusCode != 2) {
        //获取通过获取流程配置值
        this.processConfig = await this.$getConfigFn('double-optimizing_cancellation_implement')
        return
      }
     // 获取通过验收获取流程配置值
      this.processConfig = await this.$getConfigFn('double-optimizing_check-and-accept')
    },
    computed: {
      rowSelections() {
        return {
          selectedRowKeys: this.selectedRowKeys,
          selectedRows: this.selectedRows, // 当前行所有数据
          onChange: this.onSelectChanges
        }
      }
    },
    methods: {
      onSelectChanges(selectedRowKeys, selectedRows) {
        this.selectedRowKeys = selectedRowKeys
        this.selectedRows = selectedRows
        let fileFileds = []
        let fileIds = []
        selectedRows.forEach(function(obj, i) {
          fileFileds.push(obj.fileId)
          fileIds.push(obj.commonId)
        })
        this.fileFileds = fileFileds.join(',') // 删除公共附件
        this.fileIds = fileIds // 有业务id 删除附件
      },

      getOptimizationDetails() {
        let that = this
        this.spinning = true
        getOptimizationDetails({ id: that.id }).then((res) => {
          this.spinning = false
          if (res.data.isImpl === '已实施') {
            res.data.isImpl = 1
          } else if (res.data.isImpl === '未实施') {
            res.data.isImpl = 0
          }
          if (res.data.remarks) {
            res.data.remark = res.data.remarks
          }
          if (!res.data.outputPictureIdsInfo) {
            res.data.outputPictureIdsInfo = []
          }
          if (!res.data.outputFileIdsInfo) {
            res.data.outputFileIdsInfo = []
          }
          if (!res.data.promotionFileIdsInfo) {
            res.data.promotionFileIdsInfo = []
          }
          if (res.data.implementStartDate) {
            res.data.implementDate = [res.data.implementStartDate, res.data.implementEndDate]
          }
          this.fileIds = res.data.outputFileIdsInfo
          that.dels = res.data
          that.form = res.data
          if (this.isEdit == 1 && (this.statusCode == 0 || this.statusCode == 7)) {
            this.form.isImpl = 1
            this.form.sellerName = this.$userInfo().name
            this.getCurrentDate()
          }
          if (that.isAudit === true) {
            that.$emit('finish', this.form)
          }
          this.dataSource3[0].opinions = this.dels.confirmationContentOne
          this.dataSource3[1].opinions = this.dels.confirmationContentTwo
          this.dataSource3[2].opinions = this.dels.confirmationContentThree
          this.dataSource3[3].opinions = this.dels.confirmationContentFour
          this.dels.viewName = this.dels.branch + '/' + this.dels.projectName
          if(this.isEdit == 0 || this.statuCode != 2) {
            that.form2 = res.data
            let actualBenefit =  (parseFloat(that.form.actualIncreaseBenefit || 0)*100 + parseFloat(that.form.actualReduceBenefit || 0)*100)/100
            that.form2.actualBenefit = actualBenefit.toFixed(2)
          }

          if (that.dels.typeId == 111) {
            that.dels.typeName = '设计优化'
          } else if (that.dels.typeId == 222) {
            that.dels.typeName = '施工组织设计(方案)优化'
          }
          that.implementers = res.data.mainImplementers

          if (that.statusCode == 0) {
            this.form.implementBenefits = this.dels.forecastBenefit
          } else if ((that.statusCode == 3 || that.statusCode == 4 || that.statusCode == 2) || this.isEdit == 0) {
            // 验收
            that.checkFiles = res.data.implementFileIdsInfo || []
          }

          if (that.reviewButton == 1 && that.statusCode == 2) {
            that.form2 = res.data

            let names = res.data.implementers
            let nameArr = []
            names.forEach(function(obj, i) {
              nameArr.push(obj.name)
            })
            that.form2.implementers = nameArr.join(',')

            that.form2.actualBenefit = parseFloat(parseFloat(this.dels.actualIncreaseBenefit) + parseFloat(this.dels.actualReduceBenefit)).toFixed(2)
          }
        })
      },

      getReduceBenefit(val) {
        if (this.form2.actualIncreaseBenefit != '' && this.form2.actualIncreaseBenefit != undefined) {
          this.form2.actualBenefit = parseFloat(parseFloat(this.form2.actualIncreaseBenefit) + parseFloat(val)).toFixed(2)
        } else {
          this.form2.actualBenefit = 0
        }
      },
      getTotalBenefit(val) {
        let count = parseFloat(parseFloat(val) + parseFloat(this.form2.actualReduceBenefit)).toFixed(2)
        this.form2.actualBenefit = count
      },

      getCurrentDate() {
        var d1 = new Date()
        var year = d1.getFullYear() //年
        var month = d1.getMonth() + 1 //月
        var day = d1.getDate() //日

        if (month < 10) {
          month = '0' + month
        }
        if (day < 10) {
          day = '0' + day
        }
        this.form.salesTime = year + '-' + month + '-' + day
      },

      goBack() {
        this.$multiTab.close(this.$route.fullpath)
      },

      submit() {
        this.setProcessConfig = null
        let that = this
        if (this.statusCode != 2) {
          let commomIds = []
          let pictureIds = []
          that.fileIds.forEach(function(obj, i) {
            commomIds.push(obj.commonId)
          })
          that.form.fileIds = commomIds
          if (this.form.isImpl === 1) {
            if (commomIds.length === 0) {
              this.$message.warning('请上传相关附件')
              return
            }
          }
        // 销项
        this.$refs.form1.validate((valid, values) => {
          if (!valid) return
          if (this.form.outputPictureIdsInfo.length < 5 && this.form.isImpl === 1) {
            this.$message.warning('请至少上传五张照片')
            return
          }
          this.form.outputPictureIdsInfo.forEach(item => {
            pictureIds.push(item.commonId)
          })
          this.form.pictureIds = pictureIds
          this.loading = true
          this.submitApprovalConfirm(this.processConfig, async (flag) => {
            if (!flag) {
              this.loading = false
              return
            }
            this.form.applyId = this.id

            if (this.form.implementDate?.length) {
              this.form.implementStartDate = this.form.implementDate[0]
              this.form.implementEndDate = this.form.implementDate[1]
            }
            let form = { ...this.form }
            form.isImpl = this.form.isImpl === 1
            if (this.form.isImpl === 0) {
              let obj = {
                applyId: this.id,
                remark: this.form.remark,
                isImpl: form.isImpl
              }
              form = obj
            }
            let q = {
              applyId: this.id,
              confirmationContentOne: '',
              confirmationContentTwo: '',
              confirmationContentThree: '',
              confirmationContentFour: '',
              level: '',
              economicBenefitsMethod: '',
              economicBenefitsScope: ''
            }
            if (form.economicBenefitsMethod) {
              await updateImplementation(q)
            }
            await editImplementation(form).then(res => {
              this.loading = false
              if (res.data.code == 200) {
                this.$message.success('提交成功')
                if (this.form.isImpl === 1) {
                  this.setProcessConfig = this.processConfig
                  this.businessId = this.id + '_C_A_N'
                } else {
                  this.goBack()
                }
                // this.form = {}
              } else {
                this.$message.success('提交失败')
              }
            }).catch(() => {
              this.loading = false
            })
          })
        })
        }
        else {
          let commomIds = []
          that.checkFiles.forEach(function(obj, i) {
            commomIds.push(obj.commonId)
          })
          that.form2.fileIds = commomIds
          if (commomIds.length === 0) {
            this.$message.warning('请上传相关附件')
            return
          }
          this.$refs.form2.validate((valid, values) => {
            if (!valid) return
            this.loading = true
            this.submitApprovalConfirm(this.processConfig, async (flag) => {
              if (!flag) {
                that.loading = false
                return
              }
              that.form2.id = that.id
              console.log(' this.form20', that.form2)
              editImplementAcceptance(that.form2).then(res => {
                this.loading = false
                if (res.data.code == 200) {
                  that.$message.success('提交成功')
                  //提交时，返回id
                  that.businessId = this.form2.id + '_A_C_C'
                  that.setProcessConfig = this.processConfig
                } else {
                  that.$message.success('提交失败')
                }
              })
            })
          })
        }
      },

      editorContent(val) {
        this.form2.acceptance = val
      },
      changeData() {
        this.visible = true
      },
      getUserBranch() {
        // 获取分公司
        getUserBranch().then((res) => {
          this.companys = res.data
        })
      },
      getProjectById(value) {
        // 根据分公司查询项目
        getUserProject(value).then((res) => {
          this.projectNames = res.data
        })
      },
      getPosts(value) {
        // 查询项目详情
        getProjectsDel(value).then((res) => {
          this.projectType = res.type
        })
      }
    }
  }
</script>


<style scoped lang="less">
  /deep/ .requiredFormItem.ant-input-number {
    border: 0 !important;
  }

  /deep/ .ant-input-number:focus {
    box-shadow: none !important;
  }

  /deep/ .ant-input-number-handler-wrap {
    display: none !important;
  }
</style>
